//
//  ShouCangCell.m
//  SeeTheWorld
//
//  Created by dllo on 16/2/24.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "ShouCangCell.h"
#import "ModelOfClickZhuanTiCell.h"
#import "PCH.pch"
#import <UIImageView+WebCache.h>


@interface ShouCangCell ()

@property (nonatomic, retain)UIImageView *imageOfLeft;
@property (nonatomic, retain)UILabel *labelOfName;
@property (nonatomic, retain)UILabel *labelOfTitle;

@end

@implementation ShouCangCell

- (void)dealloc {
    [_imageOfLeft release];
    [_labelOfName release];
    [_labelOfTitle release];
    [super dealloc];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        [self createSubviews];
        
        
    }
    
    return self;
    
}

- (void)createSubviews {
    
    self.imageOfLeft = [[UIImageView alloc] init];
    [self.contentView addSubview:self.imageOfLeft];
    [_imageOfLeft release];
    
    self.labelOfName = [[UILabel alloc] init];
    [self.contentView addSubview:self.labelOfName];
    [_labelOfName release];
    self.labelOfName.font = [UIFont systemFontOfSize:20];
    self.labelOfName.dk_textColorPicker = DKColorWithRGB(0x343434, 0xffffff);

    
    self.labelOfTitle = [[UILabel alloc] init];
    [self.contentView addSubview:self.labelOfTitle];
    [_labelOfTitle release];
    self.labelOfTitle.font = [UIFont systemFontOfSize:17];
    self.labelOfTitle.dk_textColorPicker = DKColorWithRGB(0x343434, 0xffffff);

}

- (void)layoutSubviews {
    [super layoutSubviews];
    
    self.imageOfLeft.frame = CGRectMake(10, 10, self.contentView.frame.size.width / 3, self.contentView.frame.size.height - 20);
    self.labelOfName.frame = CGRectMake(10 + self.contentView.frame.size.width / 3 + 5, 10, self.contentView.frame.size.width / 3 * 2 - 20, (self.contentView.frame.size.height - 30) / 2);
    self.labelOfTitle.frame = CGRectMake(10 + self.contentView.frame.size.width / 3 + 5, 10 + (self.contentView.frame.size.height - 30) / 2 + 10, self.contentView.frame.size.width / 3 * 2 - 20, (self.contentView.frame.size.height - 30) / 2);
    
}

- (void)passModel:(ModelOfClickZhuanTiCell *)model {
    
    self.labelOfName.text = model.name;
    self.labelOfTitle.text = model.title;
    
    [self.imageOfLeft sd_setImageWithURL:[NSURL URLWithString:model.image_url] placeholderImage:[UIImage imageNamed:@"1f178a82b9014a90e9109296ad773912b31beeeb"]];
    
    
    
}





@end
